let url = "http://192.168.1.35:1337";
// let url = 'http://localhost:1337'
$('#bnt').on('click', register);
$('.fkl').on('click', function() {
    location.href = 'login.html'
})
$('.home').on('click', function() {
    location.href = 'home.html'
})
let check = document.querySelector('.but input')
    // 注册
function register() {
    if (check.checked == true) {
        $.post(url + '/api/v1/auth/reg', {
            userName: $("#name").val(),
            password: $('#pass').val()
        }).then(res => {
            if (res.code == 1) {
                alert('用户名可用')
                location.href = 'login.html'
            } else if ($("#name").val() == '' || $('#pass').val() == '') {
                alert('用户名或密码不能为空')
            } else {
                alert(res.data)
            }
        })
    } else {
        alert('请阅读用户协议和隐私政策')
    }

}
//跳转登录页
// function logins() {
//     location.href = 'login.html'
// }

console.log($('.fkl'));

// let losg = document.querySelector('.fkl')
// console.log(losg)